#include <iostream>
#include <math.h>
#include <string>

using namespace std;

#define min(x,y) (x <= y ? x : y)
#define max(x,y) (x <= y ? y : x)

long long getValueOfBinaryNumber(string param)
{
  long long res = 0;
  int temp;
  for(int i=param.size()-1; i>=0; i--)
  {
    temp = param.size()-i-1;
    if(param[i] == '1')
      res+=(long long)pow(2,temp);
  }
  ///cout<<param<<" = "<<res<<endl;
  return res;
}

int main()
{
  int ncases;
  string strNum1, strNum2;
  long long num1, num2;
  int OK;
  
  cin>>ncases;
  
  for(int i=1; i<=ncases; i++)
  {
    cin>>strNum1>>strNum2;
    
    if(strNum1[strNum1.size()-1] == '0' && strNum2[strNum2.size()-1] == '0')
    {
      cout<<"Pair #"<<i<<": All you need is love!"<<endl;
      continue;
    }
    
    num1=getValueOfBinaryNumber(strNum1);
    num2=getValueOfBinaryNumber(strNum2);
    
    if(max(num1,num2) % min(num1,num2) == 0)
    {
      cout<<"Pair #"<<i<<": All you need is love!"<<endl;
      continue;
    }


    OK = 0;
    //cout<<sqrt(min(num1,num2))<<" "<<((long long)(sqrt(min(num1,num2)) + 1))<<endl;
    //((long long)(sqrt((double)min(num1,num2)) + 1))
    for(long long j=3; j<=((long long)(sqrt((double)min(num1,num2)) + 1)); j+=2)
    {
      if((num1 % j == 0) && (num2 % j == 0))
      {
        OK = 1;
        break;
      }
    }

    if(OK)
      cout<<"Pair #"<<i<<": All you need is love!"<<endl;
    else
      cout<<"Pair #"<<i<<": Love is not all you need!"<<endl;
  
/*    
    while(num1>1 && num2>1)
    {
      if(num1 > num2)
        num1-=num2;
      else
        num2-=num1;
    }
    
    if(num1 == 0 || num2 == 0)
      cout<<"Pair #"<<i<<": All you need is love!"<<endl;
    else
      cout<<"Pair #"<<i<<": Love is not all you need!"<<endl;
*/    
  }
  
  return 0;
}
